package com.chen.q1.business;

import com.chen.q1.aop.service.ISchool;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

@SpringBootApplication
public class AopApplication {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        Student student02 = (Student) context.getBean("student02");
        System.out.println(student02.toString());

        student02.print();

        Klass klass = context.getBean(Klass.class);
        klass.setUpKlass();

        /*ISchool school = (ISchool) context.getBean("school");
        school.newSchoolYear();*/
        ISchool school = context.getBean(ISchool.class);
        System.out.println(school);
        school.newSchoolYear();
        System.out.println("ISchool接口的对象AOP代理后的实际类型：" + school.getClass());

        System.out.println("   context.getBeanDefinitionNames() ===>> "+ String.join(",", context.getBeanDefinitionNames().toString()));
    }

}
